package com.example.demo.service;

import com.example.demo.dao.ClassroomDao;
import com.example.demo.dao.ClassroomrentalDao;
import com.example.demo.dao.LeasetimeDao;
import com.example.demo.entity.ClassroomRentalEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassroomrentalService {

    @Autowired
    private ClassroomrentalDao classroomrentalDao;
    @Autowired
    private ClassroomDao classroomDao;
    @Autowired
    private LeasetimeDao leasetimeDao;

    /**
     * 通过ID查询单条数据
     */
    public ClassroomRentalEntity queryClassroomrentalById(Integer crid){
        return classroomrentalDao.queryClassroomrentalById(crid);
    }

    /**
     * 通过实体作为筛选条件查询
     */
    public List<ClassroomRentalEntity> queryClassroomrentalAll(){
        return classroomrentalDao.queryClassroomrentalAll();
    }

    /**
     * 新增数据
     */
    public int insertClassroomrental(ClassroomRentalEntity classroomrental){


        return classroomrentalDao.insertClassroomrental(classroomrental);
    }

    /**
     * 修改数据
     */
    public int  updateClassroomrental(ClassroomRentalEntity classroomrental){
       return classroomrentalDao.updateClassroomrental(classroomrental);
    }

    /**
     * 通过主键删除数据
     */
    public void deleteByIdClassroomrental(Integer crid){
        classroomrentalDao.deleteByIdClassroomrental(crid);
    }

    public List<ClassroomRentalEntity> adminqueryClassroomrental(){
       return classroomrentalDao.adminqueryClassroomrental();
    }

    public List<ClassroomRentalEntity> adminqueryhuanClassroomrental(){
        return classroomrentalDao.adminqueryhuanClassroomrental();
    }

    public int selectBysidNextSname(int sid){
        return  classroomrentalDao.selectBysidNextSname(sid);
    }

}